package one.stand.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import one.stand.model.ResultModel;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
/**
 * @author Administrator
 */
@RestController
@RequestMapping("file")
@Api(description = "上传文件",tags="上传文件")
public class OssController extends BaseController {

    @PostMapping(value = "/uploadObjectOSS",produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
            consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    @ApiOperation(value = "上传文件")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "file", value = "文件", required = true, dataType = "MultipartFile"),
    })
    public ResultModel<String> uploadObjectOSS(MultipartFile file) {
        return ossFegin.uploadObjectOSS(file);
    }

    @PostMapping(value = "/uploadObjectOSSs",produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
            consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    @ApiOperation(value = "上传多文件")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "files", value = "文件", required = true, dataType = "MultipartFile"),
    })
    public ResultModel<String> uploadObjectOSSs(MultipartFile[] files) {
        return ossFegin.uploadObjectOSSs(files);
    }
}
